package com.egd.imapp.utils;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

import com.egd.imapp.R;

public class DevicePopWindow extends PopupWindow {
    public DevicePopWindow(Context mContext, int viewId){
        super(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
        //这里要注意设置setOutsideTouchable之前要设置 setBackgroundDrawable()
        //否则点击外部无法关闭pop
        setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        setOutsideTouchable(true);
        //获取焦点设置为true 这样再次点击菜单时 就隐藏菜单
        setFocusable(true);
        View view = LayoutInflater.from(mContext).inflate(R.layout.pop_window_device, null);
        setContentView(view);

        //设置窗口进入和退出的动画
        setAnimationStyle(R.style.pop_add);
    }
}

